package com.hockeo.server.servlet.convert;

import com.hockeo.client.model.JSData;
import com.hockeo.server.data.DAO;

/**
 * Represents an entity that is enabled for GWT. I.e. it can be transformed into a client
 * side object and constructed from a GWT object.
 *
 * @version $Id$
 * @author jjanke
 */
public interface GwtEnabled
{
  /**
   * Adds the properties of this entity to the GWT JavaScript destination object.
   *
   * @param dest the destination object to which to add any properties
   * @param dao the DAO to be used for potentially required access to the datastore
   * @param strParent the name of the parent entity to be prepended to the properties of
   *          this object
   */
  public abstract void toGwt( JSData dest, DAO dao, String strParent );

  /**
   * Adds only the most essential minimum set of properties of this entity to the GWT
   * JavaScript destination object.
   *
   * @param dest the destination object to which to add any properties
   * @param dao the DAO to be used for potentially required access to the datastore
   * @param strParent the name of the parent entity to be prepended to the properties of
   *          this object
   */
  public abstract void toGwtMinimal( JSData dest, DAO dao, String strParent );

  /**
   * Sets the properties of this object based on the properties of the given GWT
   * JavaScript object.
   *
   * @param src the JavaScript object to use for setting this object's properties
   */
  public abstract void fromGwt( JSData src );
}
